-- Item
-- Create by weism
-- 普通物品对象

Item = {
    amount = 1,
    classId = 0,
    owner = "",
};
Item.__index = Item;

-- 构造函数
function Item.new(classId, amount, owner)
    local self = {};
    setmetatable(self, Item);
    self.classId = classId;
    self.amount = amount;
    self.owner = owner;

    return self;
end

-- 取得该对象的描述字符串
function Item:get_ob_id()
    return string.format("Item:%s:%s", tostring(self.classId), tostring(self.owner));   
end

-- 物品数据
function Item:query(path)
    if (path == "class_id") then return self.classId;
    elseif (path == "amount") then return self.amount;
    elseif (path == "owner") then return self.owner;
    else
        return ItemM.query(self.classId, path);
    end
end